package com.ujson.base.common.enums;

public enum ErrorCode implements BaseEnum {
    FAIL(100000, "failed."),
    LOGIN_FAILED(100100, "login failed."),
    UN_AUTHENTICATION(100101, "unauthentication."),
    AUTH_FAIL(100102, "auth fail."),


    SUCCESS(200000, "success"),
    LOGIN_SUCCESS(200100, "login success.")
    ;

    private int code;
    private String msg;

    private ErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }

    public int getValue() {
        return this.getCode();
    }

    public boolean isSuccess() {
        return this.getCode() >= SUCCESS.getCode();
    }
    public boolean isFail() {
        return !isSuccess();
    }
}
